package com.cruise.biztest2.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.codingapi.txlcn.tc.annotation.DTXPropagation;
import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.cruise.biztest2.api.pojo.entity.LcnDemo2;
import com.cruise.biztest2.mapper.LcnDemo2Mapper;
import com.cruise.biztest2.service.LcnDemo2Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 彭闯
 * @since 2021-01-23
 */
@Service
@Transactional(rollbackFor = RuntimeException.class)
public class LcnDemo2ServiceImpl extends ServiceImpl<LcnDemo2Mapper, LcnDemo2> implements LcnDemo2Service {


    @Resource
    private LcnDemo2Mapper lcnDemo2Mapper;
    /**
     * 分布式事务注解 发起方REQUIRED， 参与方 SUPPORTS
     */

    @LcnTransaction(propagation = DTXPropagation.SUPPORTS)
    @Override
    public void addLcnDemo2(LcnDemo2 lcnDemo2) {

        lcnDemo2Mapper.insert(lcnDemo2);
        Integer a = null;
        a.toString();
    }
}
